package com.ruoyi.commodity.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.commodity.domain.CommodityOrder;
import com.ruoyi.commodity.mapper.CommodityOrderMapper;
import com.ruoyi.commodity.service.ICommodityOrderService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 订单Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-14
 */
@Service
public class CommodityOrderServiceImpl extends ServiceImpl<CommodityOrderMapper,CommodityOrder> implements ICommodityOrderService
{
    @Resource
    private CommodityOrderMapper commodityOrderMapper;

    /**
     * 查询订单
     *
     * @param id 订单主键
     * @return 订单
     */
    @Override
    public CommodityOrder selectCommodityOrderById(String id)
    {
        return commodityOrderMapper.selectCommodityOrderById(id);
    }

    /**
     * 查询订单列表
     *
     * @param commodityOrder 订单
     * @return 订单
     */
    @Override
    public List<CommodityOrder> selectCommodityOrderList(CommodityOrder commodityOrder)
    {
        return commodityOrderMapper.selectCommodityOrderList(commodityOrder);
    }

    /**
     * 新增订单
     *
     * @param commodityOrder 订单
     * @return 结果
     */
    @Override
    public int insertCommodityOrder(CommodityOrder commodityOrder)
    {
        commodityOrder.setCreateTime(DateUtils.getNowDate());
        return commodityOrderMapper.insertCommodityOrder(commodityOrder);
    }

    /**
     * 修改订单
     *
     * @param commodityOrder 订单
     * @return 结果
     */
    @Override
    public int updateCommodityOrder(CommodityOrder commodityOrder)
    {
        return commodityOrderMapper.updateCommodityOrder(commodityOrder);
    }

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deleteCommodityOrderByIds(String[] ids)
    {
        return commodityOrderMapper.deleteCommodityOrderByIds(ids);
    }

    /**
     * 删除订单信息
     *
     * @param id 订单主键
     * @return 结果
     */
    @Override
    public int deleteCommodityOrderById(String id)
    {
        return commodityOrderMapper.deleteCommodityOrderById(id);
    }
}
